////////////////////////////////////////////////////////////////////////////////
//
//	This file is part of Woozox, see <http://code.google.com/p/woozox/>.
//
//	Copyright 2008-2009 Florian David
//
//	Woozoo is free software: you can redistribute it and/or modify
//	it under the terms of the GNU Lesser General Public License as 
//	published by the Free Software Foundation, either version 3 of 
//	the License, or (at your option) any later version.
//
//	Woozoo is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU Lesser General Public 
//	License along with Woozoo. If not, see <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
package org.woozoo.xhtml.unittests.selectorsuite.selector
{
	import org.flexunit.asserts.assertTrue;
	import org.woozoo.xhtml.core.util.ElementArrayUtil;
	import org.woozoo.xhtml.unittests.selectorsuite.Case1;

	public class ClassCase extends Case1
	{
		[Test(order=1)]
		public function findElementWithClassPost() : void {
			results = document.$$('.post');
			var results1 : Array = document.$$('*.post');
			assertTrue(hasResultsAndLenEqual(3) && ElementArrayUtil.isEqual(results, results1));
		}	
			
		[Test(order=2)]
		public function findElementWithClassPostAndHentry() : void {
			results = document.$$('.post,.hentry');
			var results1 : Array = document.$$('*.post, *.hentry');
			assertTrue(hasResultsAndLenEqual(4) && ElementArrayUtil.isEqual(results1, results));
		}
				
		[Test(order=3)]
		public function findElementWithClassPostAndHentryAndPost125() : void {
			results = document.$$('.post,.hentry, .post125');
			assertTrue(hasResultsAndLenEqual(4));
		}
				
		[Test(order=4)]
		public function findElementWithClassPostOnDiv() : void {
			results = document.$$('div.post');
			assertTrue(hasResultsAndLenEqual(3));
		}		

		[Test(order=5)]
		public function findElementWithClassPostOnChildrenOfDiv() : void {
			results = document.$$('div .post');
			var results1 : Array = document.$$('div *.post');
			assertTrue(hasResultsAndLenEqual(0) && ElementArrayUtil.isEqual(results, results1));
		}		

		[Test(order=6)]
		public function findElementWithClassNavigationOnChildrenOfDiv() : void {
			results = document.$$('div .alignleft2');
			var results1 : Array = document.$$('div *.alignleft2');
			assertTrue(hasResultsAndLenEqual(1) && ElementArrayUtil.isEqual(results, results1));
		}		
	}
}